<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddColumnStepWorkflowTable extends AbstractMigration
{
    public function up()
    {
        $this->table("step_workflow")
            ->addColumn('stage_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '关联阶段'])
            ->addColumn('module_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '环节分类id'])
            ->addColumn('is_enable', 'string', ['limit' => 45, 'default' => 'no', 'comment' => '是否启用'])
            ->addColumn('step_workflow_config', 'json', ['null' => true, 'comment' => '工序流配置'])
            ->addColumn('type', 'string', ['limit' => 45, 'default' => 'step', 'comment' => '工序流类型：工序任务(step),标准生产任务(to_do),标准审核(standard_review),标准会议(standard_meeting)'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目ID'])
            ->save();
    }

    public function down()
    {
        $this->table('step_workflow')
            ->removeColumn('stage_id')
            ->removeColumn('module_id')
            ->removeColumn('is_enable')
            ->removeColumn('step_workflow_config')
            ->removeColumn('type')
            ->removeColumn('project_id')
            ->save();
    }
}
